package de.bht.netviz.ipsaver.lookup.config;

import de.bht.netviz.ipsaver.lookup.dao.GeoPluginLookupDataJpaController;
import de.bht.netviz.ipsaver.lookup.dao.IJpaController;
import de.bht.netviz.ipsaver.lookup.dao.ILookupServiceJpaController;
import de.bht.netviz.ipsaver.lookup.service.FreeGeoLookupService;
import de.bht.netviz.ipsaver.lookup.service.GeoPluginLookupService;
import de.bht.netviz.ipsaver.lookup.service.ILookupService;
import java.util.Observable;
import javax.persistence.Persistence;

/**
 * Global configuration class for the IPSaver application, implemented as an 
 * Overservable and Singleton.
 * 
 * @author Marius Hentschel
 * @since  2012/10/24
 */
public class IPSaverConfig extends Observable {
   
   private static final String PERS_UNIT_NAME = "NetVizPersistenceUnit";
   /**
    * the singleton instance
    */
   private static IPSaverConfig instance;
   
   /**
    * the current lookup service
    */
   private ILookupService currentLookupService;

   public ILookupService getCurrentLookupService() {
      return currentLookupService;
   }
   
   private IPSaverConfig() {
      currentLookupService = GeoPluginLookupService.getInstance(); //TODO: Make dynamic from XML
//      currentLookupService = FreeGeoLookupService.getInstance(); 
   }
   
   public static IPSaverConfig getInstance() {
      if( instance == null ) {
         instance = new IPSaverConfig();
      }
      return instance;
   }
   
   public static String getPERS_UNIT_NAME() {
      return PERS_UNIT_NAME;
   }
   
   
}
